import Imagelocation from '@/components/Imagelocation';
import { View } from '@tarojs/components';
import React from 'react';
import styles from './index.module.scss';

const ProductList = ({ productList }) => {
  const productLen = productList?.length;

  return (
    <View className={styles.ProductList}>
      <View className="cover"></View>
      {productList?.map((product, index) => {
        const { productReleaseImg, productReleaseTitle } = product ?? {};
        const isLast = index === productLen - 1;

        return (
          <View className="product-wrap" key={product.id}>
            <View className="product-item">
              <Imagelocation className="icon" src={productReleaseImg} />
              <View className="title omit-2">{productReleaseTitle}</View>
            </View>

            {!isLast && <View className="split-line"></View>}
          </View>
        );
      })}
    </View>
  );
};

export default ProductList;
